import React, {Component} from 'react';
import BookManagerActions from "./actions/BookManagerActions";
import CategoryStore from "./actions/CategoryStore";
import Header from "./Header";
import Footer from "./Footer";

export default class Categories extends Component {
  constructor(props) {
    super(props) ;
    const namespace = 'category';
    const categoryStore = new CategoryStore(namespace);
    BookManagerActions.register(categoryStore.updates);

    this.state = {
      'store': categoryStore,
      'activeTodoCount': 1,
      'completedCount': 0,
      'currentRoute': '',
    }
  }

  componentWillMount() {

  }

  render() {
    // let list;
    // if (this.state.shownTodos && this.state.shownTodos.length) {
    //   list = <TodoList todos={this.state.shownTodos} activeTodoCount={this.state.activeTodoCount}/>
    // }
    //
    let footer;
    if (this.state.activeTodoCount || this.state.completedCount) {
      footer = <Footer count={this.state.activeTodoCount}
                           completedCount={this.state.completedCount}
                           nowShowing={this.state.currentRoute}
      />
    }

    return (
      <div>
        <Header/>
        {/*{list}*/}
        {footer}
      </div>
    );
  }
}
